const Router = require('koa-router')
const { verifyToken } = require('@/utils/jwt')
const userActiveExamValidate = require('@/middlewares/validateMiddlewares/userActiveExamValidate')
const {
  validateSlideCode
} = require('@/middlewares/validateMiddlewares/userValidate')
const userActiveExamController = require('@/controller/userActiveExamController')
const { verifyAdmin } = require('@/middlewares/validateMiddlewares/verifyAdmin')

const router = new Router()

/**
 * 获取用户激活考试列表
 */
router.get(
  '/list',
  verifyToken(),
  // verifyAdmin(),
  userActiveExamValidate.listUserActiveExamValidate,
  userActiveExamController.listUserActiveExam
)

/**
 * 创建用户激活考试列表
 */
router.post(
  '/create',
  verifyToken(),
  userActiveExamValidate.createUserActiveExamValidate,
  userActiveExamController.createUserActiveExam
)

/**
 * 删除用户激活考试列表
 */
router.delete(
  '/delete',
  validateSlideCode(),
  verifyToken(),
  verifyAdmin(),
  userActiveExamValidate.delUserActiveExamsValidate,
  userActiveExamController.delUserActiveExams
)

/**
 * 用户激活考试排序
 */
router.put(
  '/sort',
  verifyToken(),
  verifyAdmin(),
  userActiveExamValidate.sortUserActiveExamsValidate,
  userActiveExamController.sortUserActiveExams
)

module.exports = router
